package com.handinglian.ai.notice.enums;

public enum MethodEnum {
    CALL(1,"电话方式"),
    MESSAGE(2,"短信方式");

    public static MethodEnum valueOfOrdinal(Integer ordinal) {
        return ordinal == null || ordinal >= values().length ? null : values()[ordinal];
    }
    public static MethodEnum valueOfDesc(String desc) {
        for(MethodEnum methodEnum : MethodEnum.values()){
            if(desc.equals(methodEnum.getDescription())){
                return methodEnum;
            }
        }
        return null;
    }
    public static MethodEnum valueOfKey(Integer key){
        for(MethodEnum methodEnum : MethodEnum.values()){
            if(methodEnum.getKey()==key){
                return methodEnum;
            }
        }
        return null;
    }
    private final Integer key;
    private final String description;

    MethodEnum(Integer key, String description) {
        this.key = key;
        this.description = description;
    }

    public Integer getKey() {
        return key;
    }
    public String getDescription() {
        return this.description;
    }
}
